package com.stormragetech.demo.hbase.spring.service.impl;

import com.stormragetech.demo.hbase.spring.dao.hbase.HBaseDao;
import com.stormragetech.demo.hbase.spring.service.HBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.io.IOException;

/**
 * description: //TODO
 *
 * @author: Xue Bin
 * @version: 1.0.0-SNAPSHOT
 */
@Service
public class HBaseServiceImpl implements HBaseService {

    private final HBaseDao hBaseDao;

    @Autowired
    public HBaseServiceImpl(HBaseDao hBaseDao) {
        Assert.notNull(hBaseDao, "HBaseDao cannot be null !!!");
        this.hBaseDao = hBaseDao;
    }

    @Override
    public void create() throws IOException {
        hBaseDao.create();
    }

    @Override
    public void del() throws IOException {
        hBaseDao.del();
    }

    @Override
    public String exec() throws IOException {
        hBaseDao.putUser();
        return hBaseDao.getUser();
    }
}
